package com.xcdh.trading.entity;

import com.baomidou.mybatisplus.annotation.OrderBy;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

@Data
@TableName("transaction_data")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TransactionData {

    private Long id ;
    // 股票代码
    private String symbol ;
    //股票名称
    private String name ;
    //当前价
    private Double trade ;
    //前收盘价
    private Double settlement ;
    // 涨跌幅
    @OrderBy(isDesc = false)
    private Double changepercent ;

    private String trDate ;

    private String trDateCode ;
    // 更新时间
    private String updateTime  ;

    public Double getShowPrice(){
        if(changepercent < 0){
            return -settlement ;
        }
        return settlement ;
    }

}
